using Habanero.Faces.Base;

namespace FireStarterModeller.UI
{
    public abstract class ControlManager : IControlManager
    {
        protected readonly IControlHabanero _control;
        protected readonly IControlFactory _controlFactory;

        protected ControlManager(IControlFactory controlFactory)
        {
            _controlFactory = controlFactory;
            _control = _controlFactory.CreateUserControl(GetType().Name);
// ReSharper disable DoNotCallOverridableMethodsInConstructor
            InitialiseControl();
// ReSharper restore DoNotCallOverridableMethodsInConstructor
        }

        protected abstract void InitialiseControl();

        public IControlHabanero Control
        {
            get { return _control; }
        }
    }
}
